package cn.bluethink.eguan.core.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Id;
import javax.persistence.Table;

import cn.bluethink.eguan.model.core.EgRole;
import cn.bluethink.eguan.model.core.EgUser;

/**
 * 门派成员实体模型
 * 
 * @author 苏州中科蓝迪公司所有(c)2016-2021
 * @version 0.2.0
 * @brief 驿馆+（EGUAN）
 * @note 修订历史：
 * 1、wanglei于2018/11/09设计并构建初始版本v0.2.0
 */
@Table(name = "eg_member")
public class EgMemberEntity implements Serializable {

    private static final long serialVersionUID = 1885668156532224584L;

    // 用户所属的门派ID
    @Id
    private Long fid;

    // 门派中用户唯一标识ID
    @Id
    private Long uid;

    // 门派中的角色
    private Integer role2;

    // 门派中的权限值
    private Integer purview2;

    private Date ctime;
    
    private Date utime;

    public EgMemberEntity() {

    }

    public EgMemberEntity(Long fid, Long uid, Integer role2, Integer purview2) {
        this.fid = fid;
        this.uid = uid;
        this.role2 = role2;
        this.purview2 = purview2;
    }
    
    /**
     * 实体模型转业务模型
     * @return
     */
    public EgUser createMember() {
        EgUser user = new EgUser(uid,null,null);
        user.setRole( new EgRole(role2,null,purview2));
        user.setuTime(utime);
        return user;
    }

    public Long getFid() {
        return fid;
    }

    public void setFid(Long fid) {
        this.fid = fid;
    }

    public Long getUid() {
        return uid;
    }

    public void setUid(Long uid) {
        this.uid = uid;
    }

    public Integer getRole2() {
        return role2;
    }

    public void setRole2(Integer role2) {
        this.role2 = role2;
    }

    public Integer getPurview2() {
        return purview2;
    }

    public void setPurview2(Integer purview2) {
        this.purview2 = purview2;
    }

    public Date getCtime() {
        return ctime;
    }

    public void setCtime(Date ctime) {
        this.ctime = ctime;
    }

    public Date getUtime() {
        return utime;
    }

    public void setUtime(Date utime) {
        this.utime = utime;
    }

}
